<!--
 * @Author: coman
 * @LastEditors: coman
 * @Date: 2020-06-09 17:23:11
 * @motto: No pain,No gain
 * @LastEditTime: 2020-06-09 18:01:11
--> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    请输入成绩 <input type="text" id="sc">
    <input type="button" value="提交" id="btn">
    <script>
        btn.onclick=function(){
            var score=document.getElementById("sc").value;
            // console.log(score);
            var num = parseInt(score/10) ;
            console.log(num);
            
            switch(num){
                case 9 :case 10:
                    alert("成绩为A");
                    console.log("a");
                     break;
                case 8:
                     alert("成绩为B");
                      break;
                case 7:
                     alert("成绩为C");
                       break;
                case 6:
                     alert("成绩为D");
                        break;
                case 0 : case 1: case 2: case 3: case 4: case 5:
                    alert("成绩为E");
                    break;
                    default:
                        alert("输入合法的数字")
            }
        }
    </script>
</body>
<!-- 注意 case里面不能出现变量表达式,只能是字面量表达式 -->
</html>